<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <progress max="100" value="0">
        <span>0</span>%
    </progress>

    <script>
        //1.获取dom节点
        var oP = document.querySelector('progress');
        var oS = document.querySelector('span');
        //2.
        var num = 0;
        var timer = setInterval(() => {
            num++;
            oP.value = num;
            oS.innerHTML = num;
            if (num >= 100) {
                clearInterval(timer);
            }
        }, 100);

    </script>
</body>

</html>